import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeTest01 {

    public static void main(String[] args) throws Exception {
        Date newTime = new Date();
        SimpleDateFormat  sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
        String s = sdf.format(newTime);
        System.out.println(s);

        String s1 = "2022-1-17 14:56:56 333";
        SimpleDateFormat  sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
        Date d = sdf1.parse(s1);
        System.out.println(d);

    }
}
